<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>QRCode Demo</title>
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" charset="utf8" src="js/qr/jquery.qrcode.min.js"></script>
<script type="text/javascript">
function _getDownloadInlineCopyUrl(url, sMessage , fMessage) {
	$('#copyUrlSpan').html('')
    var urlInput = document.createElement('input');
    var copyError = null;
    urlInput.value = url;
    document.body.appendChild(urlInput);
    urlInput.select();
    try {
        document.execCommand("Copy", false, null);
    } catch (e) {
        copyError = e;
    } finally {
        document.body.removeChild(urlInput);
        if (copyError != null){
            alert(fMessage + "\n url : " + url);
        } else{
        	$('#copyUrlSpan').html(sMessage)
            $('#copyUrlSpan').show();
            setTimeout(function() {
            	$('#copyUrlSpan').hide();
             },2500);           
        }
    }
}

$(document).ready( function () {
	var copy = document.getElementById('copy');
	copy.onclick= function(event) {
		_getDownloadInlineCopyUrl("www.baidu.com", "Copy Done.", "Failed to Copy.")
	}
	
	$('#qrcode').qrcode(
			{
				width: 200,
				height: 200,
				text: "Hello QRCode."
				
			});
	
});
</script>
</head>

<body>
<button id="copy">Copy</button>&nbsp;<span id="copyUrlSpan" style="display:none;background:#aaaaaa;color:white;border-radius:3px;z-index:1;white-space:nowrap;padding:0px 3px;"></span>
<div id="qrcode">

</div>
</body>
</html>